package model;

import java.util.ArrayList;
import java.util.List;

public class PizzaStore implements StoreSubject {
    private List<StoreObserver> observers = new ArrayList<>();
    private String operation;

    public void setOperation(String operation) {
        this.operation = operation;
        notifyObservers();
    }

    @Override
    public void attach(StoreObserver observer) {
        observers.add(observer);
    }

    @Override
    public void detach(StoreObserver observer) {
        observers.remove(observer);
    }

    @Override
    public void notifyObservers() {
        for (StoreObserver observer : observers) {
            observer.update(operation);
        }
    }
}

